package at.sysarch.bean;

import java.io.File;

import at.pimpmypipe.interfaces.Readable;
import at.sysarch.domain.TransferImage;
import at.sysarch.filter.Source;
import at.sysarch.utils.LinkEvent;
import at.sysarch.utils.LinkListener;

public class FileLoad extends AbstractBean<Source> implements LinkListener {

	private static final long serialVersionUID = 1L;

	public FileLoad() {

		_filter = new Source(this);
	}
	
	@Override
	public void linkBean(LinkEvent event) {
	}

	@Override
	public void addLinkListener(LinkListener listener) {
		listener.linkBean(new LinkEvent((Readable<TransferImage>)_filter));
	}

	@Override
	public void removeLinkListener(LinkListener listener) {		
	}
	
	public String getFile() {
		
		return _filter.getFile() != null ? _filter.getFile().getAbsolutePath() : "Choose File";
	}
	
	public void setFile(String fileName) {
		
		_filter.setFile(new File(fileName));
	}
}